<!DOCTYPE html>
<html>
    <head>
        <meta charset="utf-8">
        <title>Barpedia, votre compagnon anti-soif.</title>
        <link href="style.css" rel="stylesheet" media="all" type="text/css">       
        <!-- Où s'abreuver dans Paris. --> 
    </head>
    <body>
        <div id="header">
            <h1><a href="index.php"><img src="./media/Logobarpedia.png" height="25%" width="25%"/></a></h1>
            <form method="post" action="index.php">
                <input type="submit" name="create" value="Ajouter un bar" />
            </form>
        </div>
        <div id="searchbar">
            <form method="post" action="index.php">
                <input name="cp" type="text" placeholder="Code postal"/>
                <input name="name" type="text" size="40" placeholder="Nom du bar"/>
                <button class="buttonSearch" type="submit" name="Submit" value="Search">Rechercher</button>
            </form>
        </div>
        <div id="content">
            <?php
            include 'include/dbconnect.php';
            $barname = $_GET['barname'];
            $page_sql = "SELECT * FROM bar WHERE name LIKE '".mysql_real_escape_string($barname)."'";
            $page_query = mysql_query($page_sql) or die('Erreur SQL !<br />' . $page_sql . '<br />' . mysql_error());
            if (mysql_num_rows($page_query) == 0) {
                echo "Aucune ligne trou29564+vée, rien à afficher.";
            }
            while($page_data = mysql_fetch_assoc($page_query)){
                $baradresse = $page_data["adresse"];
                $barcp = $page_data["cp"];
                $bardescription = $page_data["description"];
                $barurl = $page_data["url"];
                $barnote = $page_data["note"];
            }
            
            mysql_free_result($page_query);
            ?>
            <img src="<?php echo $barurl; ?>" align="left" border="10" style="max-height: 50%; max-width: 50%;">
            <h1><p align="center"><?php echo $barname; ?></p></h1>
            <br></br>
            <p align="right"><span style="text-decoration:underline; font-weight:bold;">Adresse:</span> <?php echo $baradresse;?></p>
            <p align="right" style="font-weight: bolder"><?php echo $barcp; ?>e Arrondissement PARIS</p>
            <br></br>
            <p align="right"><span style="text-decoration:underline; font-weight:bold;">Comment le trouve les habitués:</span></p>
            <p align="right"><?php echo $bardescription; ?></p>
            <h2><p align="center" style="color: bisque"><?php echo $barnote . "/10"; ?></p></h2>                        
        </div>
        <div id="footer"><p>Projet programation php/base de données - Ionis STM</p> 
            <p>jourda_p ollari_t leblan_d  Bachelor MSI</p></div>
    </body>
</html>